<template>
	<view class="swiper-box">
		<swiper class="swiper" indicator-dots circular autoplay>
			<block v-for="(item, index) in adList" :key="index">
				<swiper-item>
					<image :src="item" class="swiper-ad__img" model="scaleToFill" :data-index="index" @tap="bannerTap"></image>
				</swiper-item>
			</block>
		</swiper>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				adList: ["https://we7.91gongju.cn/attachment/upload/5/picture/2019-08-08/5d4bc8d933fdf.jpg", "/static/images/a.png"]
			};
		},

		components: {},
		props: {},
		methods: {
			bannerTap(e) {
				let index = e.target.dataset.index;

				if (index == 1) {
					uni.navigateTo({
						url: '/pages/card/index/index'
					});
				}
			}

		}
	};
</script>
<style>
	.swiper-box {
		position: relative;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-ad {
		background: #fff;
	}

	.swiper-ad-item {
		box-sizing: border-box;
		width: 100%;
		height: 100%;
	}

	.swiper-ad__img {
		width: 100%;
		height: 100%;
	}

	.img-box {
		width: 100%;
		height: 100%;
	}

	.dots {
		position: absolute;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		bottom: 16rpx;
	}

	.dot {
		height: 12rpx;
		width: 12rpx;
		background: #d48989;
		border-radius: 6rpx;
		margin: 0 6rpx;
	}

	.btn {
		padding: 0;
		border: none;
	}
</style>
